
// 处理导入异常
import { getToken } from '@/utils/auth'
import { LOGIN } from '@/store/actions/types'


// 登录功能，只需要存储 token 即可，所以，状态默认值为：''
const initialState = getToken() || ''

const login = (state = initialState, action) => {
  switch (action.type) {
    case LOGIN:
      return action.token
    case 'login/clearToken':
      return ''
    default:
      return state
  }
}

export default login